﻿using AsmShaderConverter.AsmShader;
using AsmShaderConverter.HlslShader;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AsmShaderConverter.AsmFunctions
{
    public class AsmFunctionEndif : IConvertToHlsl
    {
        readonly string originalLineOfCode;

        public Register GetDestinationRegister()
        {
            return null;
        }
        public AsmFunctionEndif(string lineOfCode)
        {
            this.originalLineOfCode = lineOfCode;

            lineOfCode = lineOfCode.Replace(",", ""); // Remove commas.
            lineOfCode = lineOfCode.Trim(); // Remove dead space.
            var values = lineOfCode.Split(' '); // split

            switch (values.Length)
            {
                case 1:
                    break;
                default:
                    throw new Exception("Function can´t be converted! " + lineOfCode);
            }

        }

        public string ToHLSL(AsmShaderFile asmShader)
        {
            try
            {
                return String.Format("}}");
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }


        public string ToHLSLWitchComment(AsmShaderFile asmShader)
        {
            return this.ToHLSL(asmShader) + " //" + this.originalLineOfCode;
        }
    }
}
